$(function(){
	
	setTimeout(function(){
		$.ajax({
			url : $("#base_url").val() + "admin/news/ajax_gold_9999",
			success : function(result) {
				$("#sjcGold").text(result);
			}
		});
		$.ajax({
			url : $("#base_url").val() + "admin/news/ajax_usd",
			success : function(result) {
				$("#usdPrice").text(result);
			}
		});
     },1500); // milliseconds
	
	$('#price_usd').bind('change', function(){
		var usd = $(this).val().replace(',', '');
		var usdPrice = $('#usdPrice').text().replace(',', '');
		var sjcGold = $('#sjcGold').text().replace(',', '').replace(',', '');
		var vnd = usd * usdPrice;
		var sjc = parseFloat(vnd/sjcGold).toFixed(2);
		$('#price_vnd').val(vnd);
		$('#price_sjc').val(sjc);
	});
});